function setFocus(aField) {
document.forms[0][aField].focus();
}
function isAnEmailAddress(aTextField) {
if (document.forms[0][aTextField].value.length<5) {
return false;
}
else if (document.forms[0][aTextField].value.indexOf("@") < 1) {
return false;
}
else if (document.forms[0][aTextField].value.length -
 document.forms[0][aTextField].value.indexOf("@") < 4) {
return false;
}
else { return true; }
}

function isEmpty(aTextField) {
if ((document.forms[0][aTextField].value.length==0) ||
 (document.forms[0][aTextField].value==null)) {
return true;
}
else { return false; }
}

function validate() {

if (isEmpty("username")) {
	alert("Tienes Que Escribir Un nombre de Usuario.");
	setFocus("username");
	return false;
}
return true;

}
var Tools = {
  createCookie: function(name, value,seg) {
    if (seg) {
      var date = new Date();
      date.setTime(date.getTime()+(seg*1000));
      var expires = "; expires="+date.toGMTString();
    }else var expires = "";
      document.cookie = name+"="+value+expires+"; path=/";
  },

  readCookie: function(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  },

  eraseCookie: function(name) {
    Tools.createCookie(name,"",-1);
  }
};